<template>
  <van-list
    v-model="loading"
    :finished="finished"
    :immediate-check="immediateCheck"
    :finished-text="finishedText"
    @load="onLoad"

  >
   <div  class="like-list">
     <div v-for="(item,index) in list" :key="index" class="like-item">
       <van-image lazy-load :src="item.picUrl"/>
       <div class="like-item-info">
         <span class="like-item-title">{{ item.name }}</span>
         <div class="like-item-price-wrap">
           <span>¥<span class="like-item-price">{{ item.retailPrice }}</span></span>
           <span class="sold-count">已售1件</span>
         </div>
       </div>
     </div>
   </div>
  </van-list>

</template>

<script>
export default {
  name: 'productList',
  props: {
    loading: Boolean,
    finished: Boolean,
    immediateCheck: Boolean,
    finishedText: String,
    list: Array
  },
  methods: {
    onLoad () {
      this.$emit('load')
    }
  }
}
</script>

<style scoped>
.like-list {
  background: #f3f3f3;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: space-around;
}

.like-item {
  margin: 10px 5px 0 5px;
  background-color: white;
  padding: 10px;
  border-radius: 5px;
  box-shadow: 4px 4px 4px rgba(0, 0, 0, .05);
  width: calc(100% / 2 - 40px);
  float: left;
}

.like-item-info {
  display: flex;
  flex-direction: column;
}

.like-item-title {
  font-size: 12px;
  margin-top: 5px;
}

.like-item-price {
  font-size: 16px;
  font-weight: bold;
}

.like-item-price-wrap {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  margin-top: 5px;
  font-size: 12px;
  color: #E65D6E;
}

.sold-count {
  color: #c5c5c5;
}
</style>
